package correct.day19;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int num = in.nextInt();
            int begin = in.nextInt();
            int[] b = new int[num];

            for(int i = 0; i < num; i++) {
                b[i] = in.nextInt();
            }

            for(int i = 0; i < num; i++) {
                if(begin >= b[i]) {
                    begin += b[i];
                }else {
                    begin += common(begin, b[i]);
                }
            }
            System.out.println(begin);
        }
    }

    public static int common(int a, int b) {
        int min = a < b ? a : b;
        int c = min;
        for(int i = min; i > 0; i--) {
            if(a % i == 0 && b % i == 0) {
                return i;
            }
        }
        return 1;
    }
}
